<!--
 * @Author: jyq
 * @Date: 2021-07-12 16:53:33
 * @LastEditTime: 2021-07-13 11:22:19
 * @LastEditors: jyq
 * @Description: 
 * @FilePath: \vscode\day02\xxtx-ui\details1.html
 * 可以输入预定的版权声明、个性签名、空行等
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>行学天下-学生风采</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.14/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/moment.js/2.29.1/moment.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script type="text/javascript" src="js/jquery.js"></script>
    <link rel="stylesheet" href="css/details.css">
    <link rel="stylesheet" href="css/index.css">
    
</head>
<body>
    <div id="details">
        <div class="header">
            <div class="headLeft">
              <div class="logo" title="返回首页" @click="toIndex()">
                行学天下
              </div>
              <div class="title" title="返回首页"  @click="toIndex()">
                行学天下
              </div>
            </div>
            <div class="headRight">
              <div class="callMe">
                <a href="#callMe">
                  <img src="image/电话.png" alt="图片丢失了">
                  联系我们
                </a>
              </div>
            </div>
        </div>
        <!-- {{projectDetails}} -->
        <div class="main">
            <div class="title">
                {{projectDetails.title}}
            </div>
            <div class="time">
                {{formatDate(projectDetails.publishTime)}}|{{projectDetails.baseUser.realname}}
            </div>
            <div class="details" v-html="projectDetails.content">
            {{htmlToText(projectDetails.content)}}
            </div>
            <div class="teacher">
                <!-- <div class="title">
                </div> -->
                <div class="details">
                    <!-- {{projectDetails.teacher.realname}}
                    {{projectDetails.teacher.telephone}} -->
                </div>
                <div class="toindex">
                  <div class="myBtn" @click="thumbUp(projectDetails.id)">
                    <el-icon-star-off>点赞</el-icon-star-off>
                    <!-- 点赞 -->
                  </div>          
                </div>
            </div>        
        </div>
        <!--页面底部信息-->
        <div class="footer">
            <div id="callMe" class="callMe">
               联系我们（工作时间：9:00-17:30）
               021-56778147
               <a href="http://bruip.cn">http://bruip.cn</a>
               <a target="_blank" href="http://bruip.cn">在线客服</a> 
               <div class="beiAn">
                 <a href="http://beian.miit.gov.cn">京ICP备123456789号</a>
                 <a href="http://www.beian.gov.cn/portal/regisiterSystemInfo">公安备案号00000000</a>
               </div>
               <div class="callMe">
                 ©1999-2021杰普软件科技有限公司
               </div>
            </div>
        </div>
    </div>
</body>
<script>
    new Vue({
        el:'#details',
        data:{
            projectDetails:[],
        },
        created(){
            var id = window.location.search.split('=')[1];
            console.log(id);
            var a=axios.get('http://47.94.46.113:8888/index/article/findById?id='+id).then((res) => {this.projectDetails = res.data.data
            })
            console.log(a)
        },
        methods: {
        // 将时间戳格式化
        formatDate(date) {
        return moment(date).format('YYYY-MM-DD')
        },
        
        //将html转话成正常文本
        htmlToText(html){
            return html.replace(new RegExp('<.+?>','g'),'')
        },
        thumbUp(id){
        axios.get('http://47.94.46.113:8888/index/article/thumbUp?id='+id).then((res)=>{
          console.log(res);
          this.findArticle();
        })
        this.$message({
          message: '点赞成功',
          type: 'success'
        });
      },
      toIndex(){
          window.location.href = 'index.html'
        }
     },
       
    })
</script>
</html>